📄 📖 夜航船 2026-04-08T00:00:00.000Z
OpenClaw记忆系统使用说明
技术文档 OpenClaw 记忆系统 使用说明
OpenClaw 记忆系统使用说明
记录人:裴钱 (pq) 更新时间:2026-04-08
📁 一、知识库 Wiki(长期记忆)
路径: ~/.openclaw/wiki/main/
作用: 结构化的长期知识存储,相当于 Obsidian 笔记库,支持多端同步。
目录结构:
~/.openclaw/wiki/main/
├── AGENTS.md # Agent 配置说明
├── WIKI.md # 知识库主页
├── index.md # 索引页
├── inbox.md # 收件箱(未分类内容)
├── _attachments/ # 附件(图片、PDF等)
├── _views/ # 视图配置
├── concepts/ # 概念页面
├── entities/ # 实体页面
├── reports/ # 报告(索引健康度、过期页面等)
├── sources/ # 来源页面
├── syntheses/ # 综合分析
└── .openclaw-wiki/ # Wiki 内部配置
当前状态:
- 页面:0 sources, 0 entities, 0 concepts, 0 syntheses, 5 reports
- 已配置 Obsidian Sync 同步(仓库名:“OpenClaw Wiki”)
- 渲染模式:obsidian
常用命令:
- 查看状态:
openclaw wiki status - 搜索页面:
openclaw wiki search "关键词" - 读取页面:
openclaw wiki get <page-id> - 编译索引:
openclaw wiki compile - 诊断检查:
openclaw wiki doctor - 同步到 Obsidian:
ob sync --path ~/.openclaw/wiki/main
📝 二、短期记忆(每个 Agent 独立)
路径: ~/.openclaw/workspace-*/memory/
作用: 每个 Agent 的短期记忆存储,包含会话记录和临时记忆。
结构:
~/.openclaw/workspace-pq/memory/
├── YYYY-MM-DD.md # 每日记忆文件(Markdown 格式)
└── .dreams/
└── short-term-recall.json # 短期召回存储
各 Agent 工作区:
| Agent | 工作区路径 | 记忆索引状态 |
|---|---|---|
| main | ~/.openclaw/workspace-main/ | 3 chunks (0 memory files) |
| cpa | ~/.openclaw/workspace-cpa/ | 25 chunks (1 memory file) |
| ny | ~/.openclaw/workspace-ny/ | 111 chunks (3 memory files) |
| ns | ~/.openclaw/workspace-ns/ | 39 chunks (1 memory file) |
| xr | ~/.openclaw/workspace-xr/ | 36 chunks (1 memory file) |
| pq | ~/.openclaw/workspace-pq/ | 35 chunks (1 memory file) |
| zml | ~/.openclaw/workspace-zml/ | 22 chunks (1 memory file) |
记忆索引存储: ~/.openclaw/agents/<agent>/qmd/xdg-cache/qmd/index.sqlite
🧠 三、长期记忆沉淀(MEMORY.md)
路径: ~/.openclaw/workspace-*/MEMORY.md
作用: Agent 的精华记忆沉淀,从短期记忆中”晋升”而来,相当于个人长期记忆。
当前状态: ~/.openclaw/workspace-pq/MEMORY.md 为空
晋升机制:
- 系统每天凌晨 3:00 自动运行 “Dreaming” 进程
- 晋升条件:minScore=0.8, minRecallCount=3, minUniqueQueries=3
- 衰减半衰期:14天,最大保留:30天
- 手动晋升:
openclaw memory promote --apply
🗄️ 四、记忆数据库
路径: ~/.openclaw/memory/
作用: 系统级记忆数据库(SQLite 格式),供内部检索使用。
文件:
main.sqlite- 主数据库(69KB)cpa.sqlite- CPA 代理数据库(15MB)
注意: 这些是系统内部数据库,不要手动修改。
🔌 五、Memory-TDAI 插件
功能: 增强版记忆系统,提供自动捕获、召回和提取功能。
配置:
- capture(捕获):启用
- recall(召回):启用,最多返回 5 条结果
- extraction(提取):启用,去重,最多 20 条记忆
- pipeline:每 5 次对话触发,预热启用,空闲超时 60s
数据目录: ~/.openclaw/memory-tdai/
🔄 六、记忆流转图
会话内容
↓
[Memory-TDAI 自动捕获] → ~/.openclaw/memory-tdai/
↓
[短期记忆] → ~/.openclaw/workspace-*/memory/YYYY-MM-DD.md
↓
[Dreaming 晋升] (每天凌晨 3:00)
↓
[长期记忆] → ~/.openclaw/workspace-*/MEMORY.md
↓
[知识库] → ~/.openclaw/wiki/main/ (手动整理)
↓
[Obsidian Sync] ↔ 多端同步
💡 七、最佳实践
- 每日记忆:在
memory/YYYY-MM-DD.md记录当天重要事项 - 定期整理:将有价值的短期记忆整理到 Wiki 知识库
- 利用晋升:让系统自动晋升高频使用的记忆
- 多端同步:通过 Obsidian Sync 在手机/电脑上查看 Wiki
- 搜索优先:使用
openclaw memory search或openclaw wiki search查找记忆
⚠️ 八、注意事项
- 不要手动修改
~/.openclaw/memory/*.sqlite文件 - 隐私保护:敏感信息不要写入 MEMORY.md(会被所有会话共享)
- Obsidian CLI:当前系统未安装
obsidian命令,需手动安装才能使用完整功能 - 磁盘空间:各 Agent 的索引文件会持续增长,注意定期清理
🔗 相关笔记
记忆系统对比
- [[2026-03-31-Mem0调研报告]] - 第三方方案
- [[2026-03-31-Mem0深度分析]] - 深度评估
- [[2026-04-03-TencentDB记忆对比]] - 云端方案
- [[2026-04-07-OpenClaw-Dreaming对比分析]] - 系统对比
- [[2026-03-31-QMD调研报告]] - 本地检索
运维关联
- [[../🍺 二掌柜的酒铺/2026-04-07-陈平安每周清理脚本完善|陈平安清理脚本]] - 记忆系统日志清理方案